import { inject, injectable } from "inversify";
import { Event, EventEmitter, Uri } from "vscode";
import { IAsyncDisposableRegistry, IDisposableRegistry, Resource } from "../../common/types";
import { EQEnvironment } from "../../eqEnvironments/info";
import { IInterpreterAutoSelectionProxyService } from "./types";

@injectable()
export class InterpreterAutoSelectionProxyService implements IInterpreterAutoSelectionProxyService {

    private readonly didAutoSelectedInterpreterEmitter = new EventEmitter<void>();

    private instance?: IInterpreterAutoSelectionProxyService;

    constructor(@inject(IDisposableRegistry) private readonly disposables: IAsyncDisposableRegistry) { }

    public registerInstance(instance: IInterpreterAutoSelectionProxyService): void {
        this.instance = instance;
        this.disposables.push(
            this.instance.onDidChangeAutoSelectedInterpreter(() => this.didAutoSelectedInterpreterEmitter.fire()),
        );
    }

    public get onDidChangeAutoSelectedInterpreter(): Event<void> {
        return this.didAutoSelectedInterpreterEmitter.event;
    }
    getAutoSelectedInterpreter(resource: Resource): EQEnvironment | undefined {
        throw new Error("41Method not implemented.");
    }
    setWorkspaceInterpreter(resource: Uri, interpreter: EQEnvironment | undefined): Promise<void> {
        throw new Error("42Method not implemented.");
    }
}